﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace IronWinter
{
    public static class EquipmentLibrary
    {
        public const int  WEAPON_COUNT = 6;
        public const int ARMOR_COUNT = 5;
        public const int ITEM_COUNT = 5;

        private static Weapon[] weapList = new Weapon[WEAPON_COUNT];
        private static Armor[] arList = new Armor[ARMOR_COUNT];
        private static Item[] itemList = new Item[ITEM_COUNT];

        // ALL VALUES ARE PRETTY MUCH ARBITRARY YEA

        public static void LoadContent(
            Texture2D[] weaponTex,
            Texture2D[] arTex,
            Texture2D[] itemTex
            )
        {
            //Weapons----------------------------------------------

            //Weapon cheese = new Weapon(xxxxxx,maxHealth,armor,atkPow,rate,rangek,armorPen,MS,value,namek,Tex,colr)
            Weapon pistol = new Weapon(false, 0, 0, 5, 1, 150, 0, 0, 10, "Pistol", weaponTex[(int)Weapon.types.pistol], Color.Black);
            weapList[(int)Weapon.types.pistol] = pistol;

            Weapon shotgun = new Weapon(true, 0, 0, 20, 2, 50, 2, 0, 50, "Shotgun", weaponTex[(int)Weapon.types.shotgun], Color.Black);
            weapList[(int)Weapon.types.shotgun] = shotgun;

            Weapon assault = new Weapon(false, 0, 0, 20, .4f, 200, 1, 0, 100, "Assault Rifle", weaponTex[(int)Weapon.types.assault], Color.Black);  //Todo
            weapList[(int)Weapon.types.assault] = assault;

            Weapon plasma = new Weapon(false, 0, 0, 18, .35f, 175, 3, 0, 110, "Plasma Rifle", weaponTex[(int)Weapon.types.plasma], Color.Green);  //Todo
            weapList[(int)Weapon.types.plasma] = plasma;

            Weapon sniper = new Weapon(false, 0, 0, 75, 3, 350, 10, 0, 200, "Sniper Rifle", weaponTex[(int)Weapon.types.sniper], Color.Black);  //Todo
            weapList[(int)Weapon.types.sniper] = sniper;

            Weapon siege = new Weapon(false, 0, 0, 300, 5, 300, 100, -10, 300, "Siege Cannon", weaponTex[(int)Weapon.types.siege], Color.Red);  //Todo
            weapList[(int)Weapon.types.siege] = siege;

            //Armor---------------------------------------
            //new Armor(xxx,maxHealth,armor,atkPow,armorPen,moveSpeed,value,nam,Texture
            Armor clothes = new Armor(true, 0, 0, 0, 0, 1, 0, "Clothes", arTex[(int)Armor.types.clothes]);
            arList[(int)Armor.types.clothes] = clothes;

            Armor basic = new Armor(true, 0, 2, 0, 0, 0, 50, "Basic Armor", arTex[(int)Armor.types.basic]);
            arList[(int)Armor.types.basic] = basic;

            Armor medium = new Armor(true, 0, 4, 0, 0, -1, 75, "Medium Armor", arTex[(int)Armor.types.medium]);
            arList[(int)Armor.types.medium] = medium;

            Armor heavy = new Armor(true, 0, 8, 0, 0, -2, 125, "Heavy Armor", arTex[(int)Armor.types.heavy]);
            arList[(int)Armor.types.heavy] = heavy;

            Armor enhanced = new Armor(true, 50, 2, 10, 0, 1, 200, "Enhanced Suit", arTex[(int)Armor.types.enhanced]);
            arList[(int)Armor.types.enhanced] = enhanced;

            //Items------------------------------------------------------
            //new Item(xxx, maxHealth,armor,atkPow,armorPen,moveSpeed,value,nam,tex

            Item none = new Item(true, 0, 0, 0, 0, 0, 0, "None", itemTex[(int)Item.types.nan]);
            itemList[(int)Item.types.nan] = none;

            Item gloves = new Item(true, 0, 0, 2, 0, 0, 30, "Power Gloves", itemTex[(int)Item.types.gloves]);
            itemList[(int)Item.types.gloves] = gloves;

            Item stim = new Item(true, 50, 0, 0, 0, 2, 50, "Adrenal Stimulant", itemTex[(int)Item.types.stim]);
            itemList[(int)Item.types.stim] = stim;

            Item organ = new Item(true, 200, 0, 0, 0, 1, 100, "Enhanced Organs", itemTex[(int)Item.types.organ]);
            itemList[(int)Item.types.organ] = organ;

            Item apround = new Item(true, 0, 0, 0, 5, 0, 30, "Armor Piercing Rounds", itemTex[(int)Item.types.apround]);
            itemList[(int)Item.types.apround] = apround;


        }

        public static Weapon getWeapon(Weapon.types i)
        {
            return weapList[(int)i];
        }

        public static Weapon getWeapon(int i)
        {
            try
            {
                Weapon.types j = (Weapon.types)i;
            }
            catch
            {
                return null;
            }

            return weapList[(int)i];
        }

        public static Armor getArmor(Armor.types i)
        {
            return arList[(int)i];
        }

        public static Armor getArmor(int i)
        {
            try
            {
                Armor.types j = (Armor.types)i;
            }
            catch
            {
                return null;
            }

            return arList[(int)i];
        }

        public static Item getItem(Item.types i)
        {
            if ((int)i == -1)
            {
                return itemList[0];
            }
            return itemList[(int)i];
        }

        public static Item getItem(int i)
        {
            try
            {
                Item.types j = (Item.types)i;
            }
            catch
            {
                return null;
            }

            return itemList[(int)i];
        }

    } 
}
